#include "UnityShaderVariables.cginc"

struct Attributes
{
    float2 uv : TEXCOORD0;
    float3 normal : NORMAL;
    float4 vertex : POSITION;
};

struct Varyings
{
    float2 uv : TEXCOORD0;
    float3 normal : TEXCOORD1;
    float4 vertex : SV_POSITION;
};
			
UNITY_DECLARE_TEX2D(_MainTex);


Varyings vert (Attributes In)
{
    Varyings Out;
    Out.uv = In.uv;
    Out.normal = normalize(mul(In.normal, (float3x3)unity_WorldToObject));
    Out.vertex = mul(unity_MatrixVP, mul(unity_ObjectToWorld, float4(In.vertex.xyz, 1.0)));
    return Out;
}

void frag (Varyings In, out float4 BaseColor : SV_Target0, out float4 Microface : SV_Target1, out float4 WorldNormal : SV_Target2, out float4 Emissive : SV_Target3)
{
    BaseColor = _MainTex.Sample(sampler_MainTex, In.uv);
    Microface = float4(BaseColor.b, BaseColor.r, BaseColor.g, 1.0);
    WorldNormal = float4(In.normal, 1.0);
    Emissive = float4(1.0, 0.5, 0.1, 1.0);
}